

#ifndef CONNECTION_H
#define CONNECTION_H

#include <QHostAddress>
#include <QTcpSocket>

class Connection : public QTcpSocket
{
    Q_OBJECT

public:
    Connection(QObject *parent = 0);

signals:
    void clientReg(const QString& name, const int sockid,const int id);
    void dataReady(const QByteArray& byte, const int id );
    void datatest();

private slots:
    void processReadyRead();
    
private:
    void procReg(const QByteArray data, bool& isRegMsg);
    enum RecvState
    {
            WaitSize = 1,
            WaitData
    };
   
    RecvState state;
    int dataSize;
    QByteArray bytes;
};

#endif
